package neo.app.action;

import java.util.Map;

import neo.app.service.ServiceManager;
import neo.core.Constants;
import neo.core.bean.BeanManager;
import neo.core.common.CommonBaseAction;

public class BaseAction extends CommonBaseAction {
	
	/* ServiceManager */
	public ServiceManager getServMgr() {
		return (ServiceManager) BeanManager.getBean("serviceManager");
	}

	/* 获取登录用户ID */
	public Long getLoginUserId() {
		Map user = getLoginUser();
		if (user != null) {
			return Long.valueOf(user.get("user_id").toString());
		}
		return null;
	}

	/* 获取登录用户名 */
	public String getLoginUserName() {
		Map user = getLoginUser();
		if (user != null) {
			return (String) user.get("employee_no");
		}
		return null;
	}

	/* 获取用户真实姓名 */
	public String getLoginUserRealName() {
		Map user = getLoginUser();
		if (user != null) {
			return (String) user.get("employee_name");
		}
		return null;
	}

	/* 获取登录用户对象 */
	public Map getLoginUser() {
		return (Map) getSession().get(Constants.LOGIN_USER);
	}

}
